package question12;

/**
 * @FileName Test
 * @Description
 * @Author Sword
 * @date 2024-10-23
 **/
public class Test {
    public static void main(String[] args) {
        MyPoint point1 = new MyPoint(3, 4); // 创建点(3, 4)
        MyPoint point2 = new MyPoint(0, 0); // 创建点(0, 0)

        // 显示两个点之间的距离
        double dist1 = point1.distance(point2);
        System.out.println("点1(" + point1.getX() + ", " + point1.getY() + ")与点2(" + point2.getX() + ", " + point2.getY() + ")之间的距离: " + dist1);

        // 使用重载的 distance 方法
        double dist2 = point1.distance(1, 1); // 计算点1与(1, 1)之间的距离
        System.out.println("点1(" + point1.getX() + ", " + point1.getY() + ")与点(1, 1)之间的距离: " + dist2);

    }
}
